Skip to content

Verify integrity of downloaded Python engine packs#11

Open
phyceClaw wants to merge 1 commit into
phyce:python-integrationfrom
phyceClaw:fix/pack-install-integrity
Open

Verify integrity of downloaded Python engine packs#11
phyceClaw wants to merge 1 commit into
phyce:python-integrationfrom
phyceClaw:fix/pack-install-integrity

Conversation

@phyceClaw

Copy link
Copy Markdown

Summary

Engine-pack bundles were downloaded (accepting plain http://) and their bundled Python interpreter executed with no checksum or signature verification — a MITM or compromised release asset could run arbitrary code.

  • Reject non-HTTPS remote bundle URLs.
  • Verify the downloaded bundle SHA-256 against the trusted digest (from the GitHub asset digest) before extraction/execution; mismatch aborts and deletes the temp file.
  • Reject traversal (absolute / ..) in manifest interpreter/entrypoint paths before they are joined and exec'd.

Existing atomic .part+rename and zip-slip protections are preserved.

Digest source decision

The GitHub Releases API exposes a per-asset digest field (sha256:<hex>) on newer responses. The catalog now parses it into a new AvailablePack.ExpectedSHA256 and threads it to the installer, which hashes the download while streaming to the .part file and compares before the atomic rename.

When no trusted digest is available (older API response, or a local pack), the install proceeds but logs a prominent WARN that the bundle is UNVERIFIED, rather than hard-failing — blocking all installs would break older release assets and local dev packs. Once release assets consistently carry digests this can be tightened to enforce-always.

Testing

CGO_ENABLED=1 go build ./app/... passes. CGO_ENABLED=1 go test ./app/tts/engine/python/... passes, including new tests covering digest match/mismatch/abort, http rejection, digest parsing, and manifest path-traversal validation.

🤖 Generated with Claude Code

Engine-pack bundles were downloaded (accepting plain http) and their
bundled interpreter executed with no checksum/signature check,
allowing MITM or a compromised asset to run arbitrary code. Require
https and verify the SHA-256 digest (from the GitHub asset digest)
before extracting/executing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant